<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head th:replace="include :: header('公告- DEV社区')"></head>
<body>
<div th:replace="include :: top"></div>
<div th:replace="include :: column(${cateKey})"></div>

<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">
      <div class="fly-panel" style="margin-bottom: 0;">
        

        <ul class="fly-list" id="pageContent"> 
        	 <div class="fly-none">没有相关数据</div>         
        </ul>
        
    
        <div style="text-align: center" id="pageDiv">
        </div>

      </div>
    </div>
    <div class="layui-col-md4">
      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title">本周热议</dt>
        <dd>
          <a href="">基于 layui 的极简社区页面模版</a>
          <span><i class="iconfont icon-pinglun1"></i> 16</span>
        </dd>

        <!-- 无数据时 -->
        <!--
        <div class="fly-none">没有相关数据</div>
        -->
      </dl>

      <th:block th:include="include :: adAndFriend"/>
      

    </div>
  </div>
</div>
<th:block th:include="include :: footer('jie')"/>
<script type="text/javascript">
	$(document).ready(function() {
// 		getArtList(1);
	});
	function getArtList(page,status,rec){
		var pageSize=10;
		$.ajax({
			type : 'post',
			url : '/article/list',
			data : {
				pageNum : page,
				rec:rec,
				pageSize : pageSize,
			},
			cache : false,
			dataType : 'json',
			success : function(data) {
				var html = template('artTpl', data);
				$('#pageContent').html(html);
				layui.use('laypage', function(){
 					var laypage = layui.laypage;
					laypage.render({
						elem : 'pageDiv',
						count : data.total, 
						curr : page || 1,
						limit: pageSize,
						theme: 'main',
						jump : function(obj, first) { //触发分页后的回调
							if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
								getArtList(obj.curr);
							}
						}
					});
				});
			}
		});
	}
</script>
<script id="artTpl" type="text/html">
		{{each rows item i}}
          <li>
            <a href="/user/home/{{item.author}}" class="fly-avatar">
              <img src="{{item.bbsUser.avatar}}" alt="{{item.bbsUser.nickname}}">
            </a>
            <h2>
              <a class="layui-badge">{{item.cate | artCateStr}}</a>
              <a href="/article/detail/{{item.id}}">{{item.title}}</a>
            </h2>
            <div class="fly-list-info">
              <a href="/user/home/{{item.author}}" link>
                <cite>{{item.bbsUser.nickname}}</cite>
				{{if item.bbsUser.authContent.length>0}}
                <i class="iconfont icon-renzheng" title="认证信息：{{item.bbsUser.authContent}}"></i>
				{{/if}}
                <!-- <i class="layui-badge fly-badge-vip">VIP3</i> -->
              </a>
              <span>{{item.createTime}}</span>
              
              <span class="fly-list-kiss layui-hide-xs" title="悬赏飞吻"><i class="iconfont icon-kiss"></i> {{item.kiss}}</span>
		      {{if item.status==9}}
              <span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>
			  {{/if}}
              <span class="fly-list-nums"> 
                <i class="iconfont icon-pinglun1" title="回答"></i> {{item.comment}}
              </span>
            </div>
            <div class="fly-list-badge">
			{{if item.top}}
              <span class="layui-badge layui-bg-black">置顶</span>
			{{/if}}
			{{if item.rec}}
              <span class="layui-badge layui-bg-red">精帖</span>
			{{/if}}
            </div>
          </li>
		 {{/each}}
</script>
</body>
</html>